package com.alliance.shuwei.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.alliance.shuwei.entity.Company;
import com.alliance.shuwei.repository.CompanyDao;

@Service
@Transactional
public class CompanyService {
	@Autowired
	private CompanyDao companyDao;
	
	public Company getCompany(){
		return companyDao.findOne(1);
	}
	
	public Company saveCompany(Company company){
		Company persisted = companyDao.findOne(1);
		persisted.setCopyRight(company.getCopyRight());
		persisted.setContactInfos(company.getContactInfos());
		persisted.setFriendLinks(company.getFriendLinks());
		persisted.setFullName(company.getFullName());
		persisted.setLogo(company.getLogo());
		persisted.setLogoPicture(company.getLogoPicture());
		return companyDao.save(persisted);
	}
}
